%{
#include <stdio.h>
#include "y.tab.h"  
%}

%%

class   {return CLASS;}
const   {return CONST;}
public  {return PUBLIC;}
private {return PRIVATE;}
\*      {return STAR;}
\(      {return LP;}
\)      {return RP;}
\{      {return LB;}
\}      {return RB;}
\:      {return COLON;}
\.      {return DOT;}
\;      {return SEMICOLON;}
\,      {return COMMA;}
\<      {return LT;}
\>      {return GT;}

[ \t\n]+   ;
[a-zA-Z0-9_-]+  {yylval.string = strdup(yytext); return WORD;}

%%

// very important
// yylval.string is from e2.y see the %union define #include the e2.y
void yyerror(char *s) {
    fprintf(stderr, "%s\n", s);
}
